#include "Plane.h"

namespace GL
{
    Plane::Plane()
    {
        ObjectData Data;
        Data.l = -0.5f;
        Data.r = 0.5f;
        Data.t = 0.5f;
        Data.b = -0.5f;
        Data.f = 0.0f;
        Data.n = 0.0f;
        Data.R = 1.0f;
        Data.G = 0.0f;
        Data.B = 0.0f;
        Data.A = 1.0f;
        Data.D = 0.0f;
        Data.W = 0.0f;
        unsigned int indices[] = {
            // 注意索引从0开始!
            0, 1, 3, // 第一个三角形
            1, 2, 3  // 第二个三角形
        };
        const std::string sourceUrl = "D:/learnCode/open-gl/resource/plane.shader";
        const std::string texture0 = "D:/learnCode/open-gl/resource/1.jpg";
        const std::string texture1 = "D:/learnCode/open-gl/resource/3.jpg";
        m_Renderer = new PlaneRenderer(Data, indices, sourceUrl);
        m_Renderer->SetTexture(texture0);
        m_Renderer->SetTexture(texture1);
        glm::vec3 translate = glm::vec3(0.0f, 0.0f, -3.0f);
        m_Renderer->SetTranslate(translate);
        glm::vec3 rotate = glm::vec3(-55.0f, 0.0f, 0.0f);
        m_Renderer->SetRotate(rotate);
    }

    Plane::~Plane()
    {
    }

    void Plane::Destory()
    {
    }

    void Plane::Render()
    {
        m_Renderer->Render();
    }
    void Plane::Update()
    {
        Render();
    }
}